/**
 * related to back.ui
 * 
 * @Author : mafeng1122
 * @Timestamp : 2017-11-15
 */
var dialog  = sm("do_Dialog");
var do_DataCache = sm("do_DataCache");//sp
var do_Notification = sm("do_Notification");

var sure_button = ui("do_Button_2");
var cancle_button = ui("do_Button_1");
var text_box = ui("do_TextBox_1")

// sure
sure_button.on("touch", function (data) {
	
	var http = mm("do_Http");
	http.method = "GET";
	http.timeout = 10000;
	http.contentType = "application/x-www-form-urlencoded";
	var user_id = do_DataCache.loadData("loginer").returnObj[0].User_id;
	var current_id = do_DataCache.loadData("current").id;
	http.url = do_DataCache.loadData("baseUrl") +"BackGongDan?User_id=" + user_id +"&idList="+ current_id + "&Content=" + text_box.text;
	deviceone.print(http.url);
	http.on("success", function(data, e) {
		var jsonString = data.replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<string xmlns=\"http://tempuri.org/\">","");
		jsonString = jsonString.replace("</string>","");
		deviceone.print(jsonString);
		var bean = JSON.parse(jsonString);
		deviceone.print(bean.result);
		if (bean.result==200) {
			do_Notification.toast("退回成功");
			dialog.close();
		}else {
			do_Notification.toast(bean.msg);
		}
	});
	http.on("fail", function(data, e) {
		deviceone.print(JSON.stringify(data));
		nf.toast("网络问题");
	});
	http.request();

})

cancle_button.on("touch", function (data) {
	dialog.close();
})
